<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="renderer" content="webkit" /> 
<title>后台管理系统</title>
<link rel="stylesheet" href="statics/css/manager/login.css" type="text/css"/>
<link href="statics/assets/jquery-easyui-1.3.5/themes/default/easyui.css" rel="stylesheet" type="text/css"/>
<link href="statics/assets/jquery-easyui-1.3.5/themes/icon.css" rel="stylesheet"
	type="text/css">
<script type="text/javascript" src="statics/assets/jquery-easyui-1.3.5/jquery.min.js"></script>
<script type="text/javascript" src="statics/assets/jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="statics/assets/jquery-easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
	$(function() {
		$(".login-text").focus(function() {
			$(this).addClass("login-text-focus");
		}).blur(function() {
			$(this).removeClass("login-text-focus");
		});
		$(document).keydown(function(e) {
			if (e.keyCode == 13) {
				do_login();
			}
		});
		$("#username").focus(function() {
			$("#showerror").html("");
		});
		$("#password").focus(function() {
			$("#showerror").html("");
		});
		$("#btnLogin").click(function() {
			do_login();
		});
	});
	function do_login() {
		var username = $("#username").val();
		var password = $("#password").val();
		if (username == "") {
			$.messager.show("提示", '账号不能为空!', "info");
			$("#username").focus();
			return;
		}
		if (password == "") {
			$.messager.show("提示", '密码不能为空!', "info");
			$("#password").focus();
			return;
		}
		$.messager.progress({
			text : '数据处理中....'
		});
		$.ajax({
			url : "manager/managerLogin",
			type : "post",
			cache : false,
			dataType : "json",
			data : $("#form").serializeArray(),
			success : function(data) {
				$.messager.progress('close');
				if (data.success == "true") {
					window.location.href = data.url;
				} else {
					$.messager.alert("提示", data.msg, "info");
				}
			}
		});
	}
</script>
</head>
<body>
	<div id="login">
		<div id="loginlogo"></div>
		<div id="loginpanel">
			<div class="panel-h"></div>
			<div class="panel-c">
				<div class="panel-c-l">
					<form id="form" action="#" method="post">
						<table cellspacing="0" cellpadding="0">
							<tbody>
								<tr>
									<td colSpan="2" align="center"><H3>宅小U后台管理系统</H3>
									</td>
								</tr>
								<tr>
									<td align="right">账号：</td>
									<td align="left"><input id="username" class="login-text" name="username" value="" type="text">
									</td>
								</tr>
								<tr>
									<td align="right">密码：</td>
									<td align="left"><input id="password" class="login-text" name="password" value="" type="password">
									</td>
								</tr>

								<tr>
									<td colspan="2"><div id="showerror" style="text-align: center;color: red;"></div>
									</td>
								</tr>
								<tr>
									<td colspan="2" align="center"><input id="btnLogin" class="login-btn" value="登录" type="button" />
									</td>
								</tr>
							</tbody>
						</table>
					</form>
				</div>
				<div class="panel-c-r">
					<P>请从左侧输入登录账号和密码登录</P>
					<P>如果遇到系统问题，请联系管理员。</P>
					<P>如果没有账号，请联系管理员。</P>
					<P>......</P>
				</div>
			</div>
			<div class="panel-f"></div>
		</div>
	</div>
</body>
</html>